#include <iostream>

using namespace std;

class Date 
{
	int year, month, day;
public:
	Date() 
	{ 
		year=month=day=0;
		cout << "Default constructor called." << endl; 
	}
	
	Date(int y, int m, int d) 
	{ 
		year=y; month=m; day=d;
		cout<<"Constructor called."<<day<<endl; 
	}
	
	~Date( ) { 
		cout<<"Destructor called."<<day<<endl; 
	}
	
	void Print( )
	{
		cout<<year<<":"<< month<<":"<<day<<endl; 
	}
};

int main(int argc, char *argv[]) {
	//initialization
	Date dates[3]={Date(2003,9,20),Date(2003,9,21)};// 最后一个调用默认构造
	
	for (int i=0; i<3; i++)
		dates[i].Print();
	
	dates[2]=Date(2003,9,22); //assignment -- 创造一个临时对象，进行赋值后，再删除
	
	for (int i=0; i<3; i++)
		dates[i].Print();
}